﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 员工续签申请合同唯一索引问题优化 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            // 删除唯一索引
            migrationBuilder.DropIndex(
                name: "IX_SysHrRenewRequestBill_PersonContractId",
                table: "SysHrRenewRequestBill");

            // 重新创建普通索引（非唯一，允许重复）
            migrationBuilder.CreateIndex(
                name: "IX_SysHrRenewRequestBill_PersonContractId",
                table: "SysHrRenewRequestBill",
                column: "PersonContractId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            // 回滚：删除普通索引
            migrationBuilder.DropIndex(
                name: "IX_SysHrRenewRequestBill_PersonContractId",
                table: "SysHrRenewRequestBill");

            // 重新创建唯一索引
            migrationBuilder.CreateIndex(
                name: "IX_SysHrRenewRequestBill_PersonContractId",
                table: "SysHrRenewRequestBill",
                column: "PersonContractId",
                unique: true,
                filter: "[PersonContractId] IS NOT NULL");
        }
    }
}